//
//  DetailViewController.m
//  Test
//
//  Created by 祝文博 on 15/3/5.
//  Copyright (c) 2015年 KevinLab. All rights reserved.
//

#import "DetailViewController.h"
#import "UIImageView+WebCache.h"

@interface DetailViewController ()

@end

@implementation DetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 200)];
    imageView.contentMode = UIViewContentModeScaleAspectFill;
    [imageView sd_setImageWithURL:self.item.photoUrl];
    [imageView sd_setImageWithURL:self.item.photoUrl placeholderImage:[UIImage imageNamed:@"Loading"]];
    [self.view addSubview:imageView];
    
    UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, imageView.bounds.size.height + 40, WINDOW_WIDTH, 20)];
    nameLabel.backgroundColor = [UIColor clearColor];
    nameLabel.textColor = [UIColor grayColor];
    nameLabel.text = self.item.name;
    [self.view addSubview:nameLabel];
    
    UILabel *addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, imageView.bounds.size.height + 80, WINDOW_WIDTH, 20)];
    addressLabel.backgroundColor = [UIColor clearColor];
    addressLabel.textColor = [UIColor grayColor];
    addressLabel.text = self.item.address;
    [self.view addSubview:addressLabel];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
